import { post } from "@/api/Http.ts";

export interface ReplaceDomainRequest {
  curlCommand: string;
  newDomain: string;
}

export interface ExecuteCurlRequest {
  curlCommand: string;
  timeoutMs?: number;
}

export interface ReplaceDomainResponse {
  originalCurl: string;
  newCurl: string;
  originalDomain: string;
  newDomain: string;
}

export interface ExecuteCurlResponse {
  curlCommand: string;
  response: string;
  executionTimeMs: number;
  success: boolean;
  errorMessage?: string;
}

export const replaceCurlDomain = (request: ReplaceDomainRequest) => {
  return post('/curl/replaceDomain', request);
};

export const executeCurlCommand = (request: ExecuteCurlRequest) => {
  return post('/curl/execute', request);
};